Skip to content

SRE-1215: Upgrade @graphql-codegen/cli to 7 and its plugins to their next majors - #10088

Merged
CiaranMn merged 7 commits into
mainfrom
claude/graphql-codegen-v7-migration
Oct 23, 2026
Merged

CiaranMn merged 7 commits into
mainfrom
claude/graphql-codegen-v7-migration

Conversation

@claude

@claude claude Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Requested via Slack thread

🌟 Purpose

Prototype of the GraphQL Code Generator major upgrade, so we can see what it costs. The CLI 6 / plugin 5 line depends on @graphql-tools/utils ^11; the new majors depend on ^12, so this moves @graphql-tools/utils from 11.0.0 to 12.0.3 everywhere in the lockfile.

🔍 Changes

  • Versions. @graphql-codegen/cli ^6.2.1 → ^7.4.6, typescript 5.0.9 → 6.1.2, typescript-operations 5.0.9 → 6.1.10, typescript-resolvers 5.1.7 → 6.1.1, introspection 5.0.1 → 6.1.0, fragment-matcher 6.0.0 → 7.1.0. Transitively, the @graphql-tools/* loaders, delegate, wrap, executor (1.x → 2.0.3) and graphql-config 5.1.8. Each package resolves to a single version. @graphql-codegen/add 7.1.1 is added as a dev dependency where it is used.
  • Generated file split. typescript-operations 6 now generates the Input and Enum types its operations use, so running it in the same file as typescript declared those types twice (10 to 18 duplicates per file). This follows upstream's multi-file setup: typescript (plus typescript-resolvers in hash-api) writes schema-types.gen.ts, and typescript-operations writes api-types.gen.ts with importSchemaTypesFrom. An add line re-exports the schema types from api-types.gen.ts, so no import site changes. Upstream's single-file setup drops the typescript plugin, but hash-api imports about 100 resolver and args types and the frontend about 20 object types (such as FlowRun) from it, so we still need it.
  • base-codegen-config.ts is now typed for both plugins, because skipTypename moved from the shared visitor config to the typescript plugin's config.
  • Breaking changes that reached our code. Result types no longer get an optional __typename by default. Apollo Client's InMemoryCache adds __typename to every selection set except the root operation type, so the frontend and hash-isomorphic-utils operation types set nonOptionalTypename and skipTypeNameForRoot to match. hash-isomorphic-utils sets skipTypename: false on its schema types, so they include __typename too. The fetch-based clients (plugin-browser, hash-playwright) keep the default, since nothing adds __typename there. One cast in flow-run-table.tsx no longer typechecked and was dropped. Other changes that applied without type errors: nullable result fields are now T | null rather than optional (274 → 27 optional fields in the frontend's operation types), unmapped custom scalars default to unknown instead of any, and input ID is string | number.
  • Removed the unused @graphql-codegen/typescript-graphql-request from hash-backend-integration. Its latest stable release (7.1.0) still depends on the 6.x helpers that pin @graphql-tools/utils ^11, and only an 8.0.0 alpha moves off them.
  • Generated code. The *.gen.* files are gitignored, so they are not in the diff. After formatting before and after the same way, the regenerated output changes by roughly +880 / −870 lines across six workspaces (hash-frontend +352/−467, hash-api +264/−154, plugin-browser +96/−99, hash-playwright +92/−99, hash-isomorphic-utils +69/−42, hash-backend-integration +5/−10). The source diff is 93 added and 32 removed lines, plus the lockfile.

Checked locally:

  • codegen in all six codegen workspaces.
  • lint:tsc through turbo for hash-isomorphic-utils, hash-backend-utils, hash-api, hash-frontend, plugin-browser, hash-playwright and hash-backend-integration. All clean.
  • ESLint and oxfmt on the changed files.
  • test:unit for hash-isomorphic-utils (360 tests), hash-api (311) and hash-frontend (1450). All pass.
  • yarn install --immutable, yarn dedupe --strategy highest --check and yarn constraints, all with Yarn 4.18.1.

⚠️ Known issues

  • Not run locally: integration tests, Playwright, and a manual check of the frontend in a browser. The type changes are compile-time only, but the lost ? on result types could hide a mismatch with what Apollo's cache returns at runtime.
  • The split is the smallest change for consumers. Moving the frontend and other clients to the single-file typescript-operations setup that upstream recommends would mean replacing their uses of schema object types, and it is out of scope here.

@vercel

vercel Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hash Ready Ready Preview Oct 23, 2026 11:55am UTC
petrinaut Ready Ready Preview Oct 23, 2026 11:55am UTC
2 Skipped Deployments
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Oct 23, 2026 11:55am UTC
petrinaut-docs Skipped Skipped Oct 23, 2026 11:55am UTC

Request Review

@github-actions github-actions Bot added area/deps Relates to third-party dependencies (area) area/apps > hash* Affects HASH (a `hash-*` app) area/apps > hash-api Affects the HASH API (app) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team type/eng > backend Owned by the @backend team area/tests New or updated tests area/tests > integration New or updated integration tests area/tests > playwright New or updated Playwright tests area/apps labels Oct 19, 2026
@claude
claude Bot temporarily deployed to pull-request October 19, 2026 09:38 Inactive
@claude
claude Bot temporarily deployed to pull-request October 19, 2026 09:38 Inactive
@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.04%. Comparing base (ee9dad9) to head (ed1088b).
⚠️ Report is 26 commits behind head on main.

Files with missing lines Patch % Lines
...somorphic-utils/src/graphql/base-codegen-config.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10088   +/-   ##
=======================================
  Coverage   68.04%   68.04%           
=======================================
  Files        2006     2009    +3     
  Lines      206295   206382   +87     
  Branches     8819     8884   +65     
=======================================
+ Hits       140365   140441   +76     
+ Misses      64255    64217   -38     
- Partials     1675     1724   +49     
Flag Coverage Δ
apps.hash-ai-worker-ts 7.23% <ø> (-0.24%) ⬇️
apps.hash-api 15.79% <ø> (+0.19%) ⬆️
local.hash-backend-utils 18.13% <ø> (+11.92%) ⬆️
local.hash-isomorphic-utils 32.37% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Move `@graphql-codegen/cli` to 7.4.6 and the official plugins to their
next majors (`typescript` and `typescript-operations` 6, `typescript-resolvers`
6, `introspection` 6, `fragment-matcher` 7). This lets `@graphql-tools/utils`
resolve to 12.x across the lockfile.

`typescript-operations` 6 now emits the Input and Enum types its operations
use, so running it in the same file as `typescript` declares them twice.
Follow upstream's multi-file setup: `typescript` (and `typescript-resolvers`
in hash-api) writes `schema-types.gen.ts`, and `typescript-operations` writes
`api-types.gen.ts`, imports schema types through `importSchemaTypesFrom` and
re-exports them, so existing imports from `api-types.gen` keep working.

Result types no longer carry an optional `__typename` unless the selection
requests it, so `useHashInstance` picks the integration flags explicitly.

Drop the unused `@graphql-codegen/typescript-graphql-request` from
hash-backend-integration; its latest release still depends on the 6.x helpers.
Apollo Client's `InMemoryCache` adds `__typename` to every selection set
except the root operation type, so the frontend and hash-isomorphic-utils
operation types set `nonOptionalTypename` and `skipTypeNameForRoot` to
match. hash-isomorphic-utils also stops passing `skipTypename` to the
`typescript` plugin, so its schema types carry an optional `__typename`
like the other workspaces'.

`useHashInstance` goes back to destructuring `__typename` away, and the
flow run table reads `flowScheduleId` from the query result without
casting it to the schema `FlowRun` type.
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs October 23, 2026 11:19 Inactive
The schema types plugin now says outright that it generates `__typename`,
with a comment on why: Apollo Client adds it to every object in a response
except the root operation type. This drops the TODO comments about
reverting the `__typename` options, since the runtime behaviour is not
expected to change.
CiaranMn
CiaranMn previously approved these changes Oct 23, 2026
@CiaranMn
CiaranMn added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit 08b71fb Oct 23, 2026
84 checks passed
@CiaranMn
CiaranMn deleted the claude/graphql-codegen-v7-migration branch October 23, 2026 12:44

This branch was successfully deployed

3 active (1 outdated) and 2 inactive deployments
Preview – hash — ed1088bb Deployed Oct 23, 2026 by vercel[bot]
Preview – petrinaut — ed1088bb Deployed Oct 23, 2026 by vercel[bot]
pull-request — ed1088bb Deployed Oct 23, 2026 by claude[bot] via Sourcemaps (@apps/hash-integration-worker) #41263
Preview – petrinaut-docs — ed1088bb Deployed Oct 23, 2026 by vercel[bot]
Preview – hashdotdesign-tokens — 3caf309c Deployed Oct 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash* Affects HASH (a `hash-*` app) area/apps > hash-api Affects the HASH API (app) area/apps area/deps Relates to third-party dependencies (area) area/libs Relates to first-party libraries/crates/packages (area) area/tests > integration New or updated integration tests area/tests > playwright New or updated Playwright tests area/tests New or updated tests type/eng > backend Owned by the @backend team type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

2 participants